module.exports = appInfo => {
  return {
    keys: appInfo.name + '_1521347648761_8677',
    middleware: [],
    static:{
      gzip: true
    },
    onerror:{
      all(err, ctx){
        let { code = 100013, msg = '未知错误', data } = err;
        if(code === 'invalid_param'){
          code = 100004;
          msg = '参数错误'
        }
        ctx.status = 200;
        let res = {
          code,
          msg,
          data
        };
        if(!(ctx.get('x-client-fetch') === '1' || (ctx.get('accept')|| '').indexOf('json')>= 0)){
          res = JSON.stringify(res);
        }
        ctx.body = res;
      },
      accepts(ctx){
        if (ctx.get('x-client-fetch') === '1' || (ctx.get('accept')|| '').indexOf('json')>= 0) return 'json';
        return 'html'
      }
    },
    email:{
      host: 'smtp.qq.com',
      secureConnection: true,
      auth:{
        user: '525315462@qq.com',
        pass: 'cfoquxxkamekbiej'
      }
    }
  };
};